package com.yang.trainingCamp.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yang.trainingCamp.pojo.TrainingCampOrder;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TrainingCampOrderMapper extends BaseMapper<TrainingCampOrder> {

    @Select("select not_tco.*, c.id camper_id from training_camp_order not_tco inner join campers c on not_tco.customer_id = c.customer_id where not_tco.id not in (select tco.id from training_camp_order tco inner join obtained_order oo on tco.id = oo.order_id) and not_tco.state = 39 and not_tco.`type` = 8")
    List<TrainingCampOrder> queryNotObtainedOrder();

    @Select("select not_tco.*, c.id camper_id from training_camp_order not_tco inner join campers c on not_tco.customer_id = c.customer_id where not_tco.id not in (select tco.id from training_camp_order tco inner join obtained_order oo on tco.id = oo.order_id) and not_tco.state = 39 and not_tco.`type` = 8 limit 3 offset #{page}")
    List<TrainingCampOrder> queryNotObtainedOrderAync(Integer page);

}
